package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.UserBean;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private IUserService userService;


    @RequestMapping("findByItem")
    public IPage<UserBean>findByItem(int pageNO,String account){
        return  userService.findByItem(pageNO,account);
    }


    @RequestMapping("add")

    public String add(UserBean user,int[] roleArray){
        userService.add(user,roleArray);
        return "ok";
    }
    @RequestMapping("findById")
    public  UserBean findById(int id){
        return userService.findById(id);
    }
    @RequestMapping("update")
    public  String update(int userId,int[] roleArray){
        userService.update(userId,roleArray);

        return "ok";
    }
@RequestMapping("del")
    public  String  del(int id){
        userService.del(id);
        return "ok";
    }
}
